const serve = (params) => {
	return new Promise((reslove, reject) => {
		uni.showLoading({
			title: "加载中"
		})
		// let token = '3cbd4788-8214-48e4-9ca3-e82d3467c96a'
		uni.request({

			url: "https://attireshop.bkwlaq.com/" + params.url,
			method: params.method || 'get',
			data: params.data,
			header: {
				'token': uni.getStorageSync('token') || '',
				"platform": 'wxMiniProgram'
			},
			success: res => {
				// if (res.data.code == 401) {
				// 	uni.showToast({
				// 		title: "登录已过期",
				// 		icon: "error",
				// 		duration: 1000
				// 	})
				// 	console.log(res.data.code);
				// 	uni.setStorageSync('token', '')
				// 	uni.reLaunch({
				// 		url: "/pages/login/login"
				// 	})
				// 	return
				// }
				reslove(res.data)
				uni.hideLoading()
			},
			fail: error => {
				reject(error)
				uni.hideLoading()
			}
		})
	})
}
export default serve
